package leetcode_day._2021._202105._0110;

/**
 * @author yzh
 * @version 1.0
 * @date 2021/5/6 8:52
 * 解码异或后的数组
 * 算法：位运算
 */
public class _06_1720 {
    public static void main(String[] args) {
        System.out.println(1 ^ 2);
        System.out.println(2 ^ 3);
    }

    public int[] decode(int[] encoded, int first) {
        int[] ans = new int[encoded.length + 1];
        ans[0] = first;
        for (int i = 1; i < ans.length; i++) ans[i] = ans[i - 1] ^ encoded[i - 1];
        return ans;
    }

}
